package cs2340.todolist.model.session_management;

import android.content.Context;
import cs2340.todolist.model.account_management.AccountManager;
import cs2340.todolist.model.utility.SearchEngine.Filter;
import cs2340.todolist.model.utility.SearchEngine.NullFilter;

public class SessionManager {
	private boolean loggedIn;
	private Context currentContext;
	private AccountManager manager;
	Filter currentFilter;
	
	/**
	 * constructor
	 */
	public SessionManager(){
		loggedIn = false;
		manager = null;
		currentContext = null;
		currentFilter = new NullFilter();
	}

	/**
	 * creates an accountmanager
	 * @param context - context for the account manager
	 */
	public void createAccountManager(Context context){
		loggedIn = false;
		currentContext = context;
		manager = new AccountManager(context);
	}
	
	/**
	 * changes the context of the manager
	 * @param newContext the new context for the manager
	 */
	public void changeContext(Context newContext){
		if (manager != null){
			manager.changeContext(newContext);
		}
	}
	
	/**
	 * sets the logged in boolean
	 * @param login - whether or not you're logged in
	 */
	public void setLoggedIn(boolean login){
		loggedIn = login;
	}
		
	public AccountManager getAccountManager(){
		return manager;
	}
	public boolean getLoggedIn(){
		return loggedIn;
	}
	
	public Filter getCurrentFilter() {
		return currentFilter;
	}
	
	public void setCurrentFilter(Filter filter) {
		currentFilter = filter;
	}
}
